﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masterpages/Main.master" AutoEventWireup="true"
    CodeFile="Notification.aspx.cs" Inherits="User_Shares_Notification" %>

<%@ Register Src="../../Controls/ContentHolder/Holder1.ascx" TagName="Holder1" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <style type="text/css">
        .style1
        {
            text-align:right;
            width: 100%;
            font-family:Tahoma;
            direction:inherit;
       
        }
        
    </style>
    <script type="text/javascript">
        var TotalChkBx;
        var Counter;

        window.onload = function () {
            //Get total no. of CheckBoxes in side the GridView.
            TotalChkBx = parseInt('<%= this.GridViewNotific.Rows.Count %>');

            //Get total no. of checked CheckBoxes in side the GridView.
            Counter = 0;
        }

        function HeaderClick(CheckBox) {
            //Get target base & child control.
            var TargetBaseControl =
       document.getElementById('<%= this.GridViewNotific.ClientID %>');
            var TargetChildControl = "CheckBoxItemSelect";

            //Get all the control of the type INPUT in the base control.
            var Inputs = TargetBaseControl.getElementsByTagName("input");

            //Checked/Unchecked all the checkBoxes in side the GridView.
            for (var n = 0; n < Inputs.length; ++n)
                if (Inputs[n].type == 'checkbox' &&
                Inputs[n].id.indexOf(TargetChildControl, 0) >= 0)
                    Inputs[n].checked = CheckBox.checked;

            //Reset Counter
            Counter = CheckBox.checked ? TotalChkBx : 0;
        }

        function ChildClick(CheckBox, HCheckBox) {
            //get target control.
            var HeaderCheckBox = document.getElementById(HCheckBox);

            //Modifiy Counter; 
            if (CheckBox.checked && Counter < TotalChkBx)
                Counter++;
            else if (Counter > 0)
                Counter--;

            //Change state of the header CheckBox.
            if (Counter < TotalChkBx)
                HeaderCheckBox.checked = false;
            else if (Counter == TotalChkBx)
                HeaderCheckBox.checked = true;
        }
    </script>
    <uc1:Holder1 ID="Holder11" runat="server" Title="پیغام ها">
        <ContentTemplate>
            <asp:GridView ID="GridViewNotific" runat="server" AutoGenerateColumns="False" BackColor="White"
                BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" EmptyDataText="هیچ پیغامی برای شما موجود نیست ."
                DataKeyNames="ID" GridLines="Horizontal" OnRowDataBound="GridViewNotific_RowDataBound">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" ItemStyle-Height="25" ControlStyle-Font-Names="Tahoma"
                        ItemStyle-Width="110%" Visible="false" />
                    
                        <asp:BoundField DataField="Message" HeaderText="پیغام" ItemStyle-Height="25" ControlStyle-Font-Names="Tahoma"
                            ItemStyle-Width="110%" ItemStyle-CssClass="style1" />
                    <asp:BoundField DataField="Date" HeaderText="تاریخ" ItemStyle-Height="25" ControlStyle-Font-Names="Tahoma" />
                    <asp:TemplateField HeaderText="حذف">
                        <HeaderTemplate>
                            <asp:CheckBox ID="CheckBoxSelectAll" AutoPostBack="true" runat="server" onclick="javascript:HeaderClick(this);"
                                Checked="False" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBoxItemSelect" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBoxItemSelect_CheckedChanged" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#CCCCFF" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            </asp:GridView>
            <asp:Button ID="Button1" runat="server" Text="حذف پیغام های انتخابی" Font-Names="tahoma"
                OnClick="Button1_Click" />
        </ContentTemplate>
    </uc1:Holder1>
    <asp:Label ID="Lblstatus" runat="server"></asp:Label>
</asp:Content>
